package jdk;

import entity.User;
import jdk.service.UserService;
import jdk.service.UserServiceInterceptor;
import jdk.service.impl.UserServiceImpl;

import java.lang.reflect.Proxy;

public class Client {
    public static void main(String[] args) {


        User user = new User();
        user.setName("111");

        UserServiceImpl us = new UserServiceImpl();
        UserServiceInterceptor usi = new UserServiceInterceptor(us);
        UserService proxy=(UserService)Proxy.newProxyInstance(us.getClass().getClassLoader(),us.getClass().getInterfaces(),usi);
        proxy.addUser(user);



    }
}
